package com.zhenhunfan.bootclient.controller;

import com.zhenhunfan.HelloProto;
import com.zhenhunfan.HelloServiceGrpc;
import net.devh.boot.grpc.client.inject.GrpcClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Title:</p>
 * <p>Description:</p>
 *
 * @author zhanghong
 * @date 2023/7/18
 */
@RestController
public class TestController {

    @GrpcClient("boot-server")
    private HelloServiceGrpc.HelloServiceBlockingStub stub;

    @GetMapping("test")
    public String test(){
        HelloProto.HelloResponse response = stub.hello(HelloProto.HelloRequest.newBuilder().
                setName("测试").build());
        return response.getResult();
    }
}
